package cn.tworice;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
public class Application {
    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext run = SpringApplication.run(Application.class, args);

        ConfigurableEnvironment env = run.getEnvironment();
        String port = env.getProperty("server.port");
        String ip = InetAddress.getLocalHost().getHostAddress();
        System.out.print("----------------------------------------------\n\t"+
                "Application is running!\n\t"+
                "Local:\t\thttp://localhost:"+port+"\n\t"+
                "External:\thttp://"+ip+":"+port+"\n"+
                "----------------------------------------------");
    }
}
